//
//  LGReportDetailContentCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/6/8.
//

#import "LGReportDetailContentCell.h"

@interface LGReportDetailContentCell()

/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIButton *titleBtn;
/**   */
@property (nonatomic , strong)UILabel *contentLabel;

@end

@implementation LGReportDetailContentCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setTitle:(NSString *)title{
    _title = title;
    [self.titleBtn setTitle:title forState:UIControlStateNormal];
    if(title.length>5){
        _titleBtn.frame = CGRectMake(0, viewPix(20), 135, 27);
    }else{
        _titleBtn.frame = CGRectMake(0, viewPix(20), 112, 27);
    }
}

-(void)setContent:(NSString *)content{
    _content = content;
    content = (content.length>0)?content:@"暂无内容";
    self.contentLabel.text = content;
    [self.contentLabel lineSpacing:3];
}



-(void)createSubView{
    self.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.baseView];
    [self.baseView addSubview:self.titleBtn];
    [self.baseView addSubview:self.contentLabel];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(viewPix(8));
        make.left.equalTo(self.contentView).offset(viewPix(16));
        make.right.equalTo(self.contentView).offset(-viewPix(16));
        make.bottom.equalTo(self.contentView).offset(-viewPix(8));
    }];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.baseView).offset(viewPix(55));
        make.left.equalTo(self.baseView).offset(viewPix(16));
        make.right.equalTo(self.baseView).offset(-viewPix(10));
        make.bottom.equalTo(self.baseView).offset(-viewPix(16));
    }];
}


-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.1 radius:15];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}


-(UIButton *)titleBtn{
    if(!_titleBtn){
        _titleBtn = [UIButton buttonWithTitle:@"" titleFont:LGFontWeight(16, UIFontWeightMedium) textColor:@"#1F6CC6" imageName:@""];
        [_titleBtn setBackgroundImage:[UIImage imageNamed:@"就诊检查-蓝色"] forState:UIControlStateNormal];
        _titleBtn.frame = CGRectMake(0, viewPix(20), 112, 27);
        _titleBtn.userInteractionEnabled = NO;
    }
    return _titleBtn;
}

-(UILabel *)contentLabel{
    if(!_contentLabel){
        _contentLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFont(15) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _contentLabel;
}






- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
